package com.bbx.taxi.client.Activity.Base;

import com.bbx.taxi.official.R;
import com.bbx.taxi.official.R.anim;
import com.bbx.taxi.official.R.id;
import com.bbx.taxi.official.R.layout;

import butterknife.ButterKnife;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.RelativeLayout.LayoutParams;

public class BaseFragment extends Fragment {
	private Context mContext;

	// 内容区域的布局
	private View contentView;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		mContext = getActivity();
		onCreateView(savedInstanceState);
		findView();
		return contentView;
	}

	public void onCreateView(Bundle savedInstanceState) {

	}

	protected View findViewById(int id) {
		return contentView.findViewById(id);
	}

	private void findView() {
		
	}

	/***
	 * 设置内容区域
	 * 
	 * @param resId
	 *            资源文件ID
	 */
	public void setContentView(int resId) {
		LayoutInflater inflater = (LayoutInflater) getActivity()
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		contentView = inflater.inflate(resId, null);
		LayoutParams layoutParams = new LayoutParams(LayoutParams.FILL_PARENT,
				LayoutParams.FILL_PARENT);
		contentView.setLayoutParams(layoutParams);
		contentView.setBackgroundDrawable(null);
	}
	public void startActivity(Intent intent) {
		super.startActivity(intent);
		getActivity().overridePendingTransition(R.anim.base_slide_right_in,
				R.anim.base_slide_remain);
	}

	public void startActivityForResult(Intent intent, int code) {
		super.startActivityForResult(intent, code);
		getActivity().overridePendingTransition(R.anim.base_slide_right_in,
				R.anim.base_slide_remain);
	}
}
